package chapter5;

public class OverLoad {
	private String className="OverLoad";
	public OverLoad(int i){}
	
	
	public OverLoad(){}
	public void widdenType(double x)
	{
		System.out.println("double");
	}
	public void widdenType(int x)
	{
		System.out.println("int");
	}
	
	public void widdenType(byte x)
	{
		System.out.println("byte");
	}

	public void widdenType(short x)
	{
		System.out.println("short");
	}
	
	public String toString()
	{
		return className;
	}
	//不能通过返回值来重载
//	public int widdenType(short x)
//	{
//		System.out.println("short");
//		return 1;
//	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		OverLoad ol=new OverLoad();
		long l=1L;
		int i=1;
		float f=1f;
		double d=1d;
		//byte->short->int->long->float->double
		ol.widdenType(l);
		ol.widdenType(i);
		ol.widdenType(f);
		ol.widdenType(d);
		
		//cgar->int->long->float->double
		char c=1;
		ol.widdenType(c);

	}

}
